package org.sagitta.httprpc.message;

import org.sagitta.httprpc.exception.RPCException;

public class FaultResponse extends Response {

	private static final long serialVersionUID = 8379609512956773625L;
	private String detail;
	private int code;

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	static public FaultResponse createActionNotExistResponse() {
		FaultResponse response = new FaultResponse();
		response.code = RPCException.ACTIONNOTEXIST;
		response.setDetail("Action not exist.");
		return response;
	}
	
	static public FaultResponse createFaultResponse(int code, String detail) {
		FaultResponse response = new FaultResponse();
		response.setDetail(detail);
		return response;
	}
}
